import request from '@/utils/request';

// get 获取所有资源
export async function fetchAuthAccess(params) {
  return request('/admin/access/saveAuthAccess', {
    params,
  });
}

// get 获取角色资源
export async function fetchAccessTree(params) {
  return request('/admin/access/listAccess', {
    params,
  });
}

// get 获取角色配置资源父级
export async function fetchGetAccessTree(params) {
  return request('/admin/access/getAccessTree', {
    params,
  });
}

// post 保存资源配置
export async function fakeAuthAccess(data) {
  return request('/admin/access/saveAuthAccess', {
    method: 'post',
    data,
  });
}
// get 获取所有角色
export async function fetchListRole(params) {
  return request('/admin/role/listRole', {
    params,
  });
}

// post 新增角色
export async function fakeAuthRole(data) {
  return request('/admin/role/saveAuthRole', {
    method: 'post',
    data,
  });
}

// post 保存角色与资源关系
export async function fakeRoleAccess(data) {
  return request('/admin/access/saveRoleAccess', {
    method: 'post',
    data,
  });
}
///获取全部管理员
export async function fetchListAdmin(params) {
  return request('/admin/listAdmin', {
    params,
  });
}

///获取全部管理员
export async function fetchRoleTree(params) {
  return request('/admin/role/getRoleTree', {
    params,
  });
}

///保存管理员
export async function fakeAuthAdmin(data) {
  return request('/admin/saveAuthAdmin', {
    method: 'post',
    data,
  });
}
